home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CDsupport / IDer / Routines / AppIcon.s next >
Text File  |  1997-02-18  |  3KB  |  174 lines

  1. DoAppIcon:    Move.W    #CUSTAPPICONERR,_ErrorCode
  2.  
  3.     Move.L    _AppIcon(PC),A2
  4.     Cmp.L    #0,A2
  5.     Beq.S    .UseDefIcon
  6.  
  7.     Lea    Info(PC),A0
  8.     Move.L    A2,A1
  9.     Bsr    FindData
  10.     Tst.L    D0
  11.     Bne.S    .No_Info
  12.     Clr.B    (A0)
  13. .No_Info    Move.L    A2,A0
  14.  
  15.     CALL    GetDiskObject,ICON
  16.     Move.L    D0,_IconObject
  17.     Bne    .GotIcon
  18.  
  19.     Bsr    ErrorHandler
  20.  
  21. .UseDefIcon    Move.W    #APPICONERR,_ErrorCode
  22.  
  23.     Move.L    _WBMessage(PC),A0
  24.     Move.L    sm_ArgList(A0),A2
  25.     Cmp.L    #0,A2    
  26.     Beq    CloseDown
  27.  
  28.     Move.L    (A2),D1        ;wa_Lock
  29.     CALL    CurrentDir,DOS
  30.     Move.L    D0,_OldDirectory
  31.  
  32.     Move.L    wa_Name(A2),A0
  33.     CALL    GetDiskObject,ICON
  34.     Move.L    D0,_IconObject
  35.     Beq    CloseDown
  36. .GotIcon
  37. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  38.     Move.L    _OldDirectory(PC),D1
  39.     CALL    CurrentDir,DOS
  40.     Clr.L    _OldDirectory
  41.  
  42. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  43.     Move.L    _IconObject(PC),A0
  44.  
  45.     Move.L    _AppIconX(PC),do_CurrentX(A0)
  46.     Move.L    _AppIconY(PC),do_CurrentY(A0)
  47.  
  48. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  49.     CALL    CreateMsgPort,EXEC
  50.     Move.L    D0,_AppMsgPort
  51.     Beq    CloseDown
  52.  
  53.     Move.L    D0,A0
  54.     Moveq    #0,D0
  55.     Move.B    MP_SIGBIT(A0),D0
  56.     Moveq    #1,D1
  57.     Lsl.L    D0,D1
  58.     Move.L    D1,_Signal
  59.  
  60.     OPENLIBRARY    WB,0
  61.  
  62.     Moveq    #69,D0        ;ID
  63.     Moveq    #0,D1        ;UserData
  64.     Move.L    _AppName(PC),A0        ;text
  65.     Move.L    _AppMsgPort(PC),A1    ;msg port
  66.     Sub.L    A2,A2        ;lock (not used)
  67.     Move.L    _IconObject(PC),A3    ;icon
  68.     Sub.L    A4,A4        ;Tags (not used)
  69.     CALL    AddAppIconA,WB
  70.     Move.L    D0,_AppIconActual
  71.     Beq    CloseDown
  72.  
  73.     Clr.W    _ErrorCode
  74.  
  75. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  76. AppLoop:    Move.L    _Signal(PC),D0
  77.     BSet    #SIGBREAKB_CTRL_C,D0
  78.     CALL    Wait,EXEC
  79.     Btst    #SIGBREAKB_CTRL_C,D0
  80.     Bne    CloseDown
  81.  
  82. .MsgLoop    Move.L    _AppMsgPort(PC),A0
  83.     CALL    GetMsg,EXEC
  84.     Tst.L    D0
  85.     Beq.S    AppLoop
  86.     Move.L    D0,_AppMsg
  87.  
  88.     Move.L    D0,A0
  89.     Move.L    am_NumArgs(A0),D0
  90.     Tst.L    D0
  91.     Beq.S    .NoArgsProvided
  92.  
  93. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  94.     Move.L    am_ArgList(A0),A1
  95.     Move.L    am_NumArgs(A0),D0
  96.  
  97.     Move.L    A1,_CurrentName
  98.     Move.W    D0,_LoopCount
  99.     Beq.S    .MsgLoop
  100.  
  101.     Clr.L    FileName
  102.     Move.W    #ARGS_ICONS,_ArgMode
  103.     Bsr    DoFiles
  104.  
  105.     Move.L    _AppMsg(PC),A1
  106.     CALL    ReplyMsg,EXEC
  107.     Clr.L    _AppMsg
  108.     Bra.S    .MsgLoop
  109.  
  110. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  111. .NoArgsProvided    Sub.L    A0,A0        ;window to open on
  112.     Lea    _esReq(PC),A1        ;easyrequest structure
  113.     Sub.L    A2,A2        ;no custom IDCMP requests
  114.     Move.L    #AboutText,es_TextFormat(A1)    ;requestor text
  115.     Move.L    #AboutGads,es_GadgetFormat(A1)    ;requestor gadget
  116.     Sub.L    A3,A3        ;requestor text arguments
  117.     CALL    EasyRequestArgs,INTUI    ;bring up the requestor.
  118.  
  119.     Cmp.B    #1,D0
  120.     Beq.S    .UseASL
  121.  
  122.     Cmp.L    #2,D0
  123.     Beq    CloseDown
  124.  
  125.     Move.L    _AppMsg(PC),A1
  126.     CALL    ReplyMsg,EXEC
  127.     Clr.L    _AppMsg
  128.  
  129.     Bra.S    .MsgLoop
  130.  
  131. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  132. .UseASL    Move.W    #ASLOPENERR,_ErrorCode
  133.  
  134.     Tst.L    _ASLBase
  135.     Bne.S    .GotASLLib
  136.     OPENLIBRARY    ASL,38
  137.  
  138. .GotASLLib    Move.W    #ASLREQERR,_ErrorCode
  139.  
  140.     Moveq    #ASL_FileRequest,D0
  141.     Sub.L    A0,A0
  142.     CALL    AllocAslRequest,ASL
  143.     Move.L    D0,_Requestor
  144.     Beq.S    CloseDown
  145.  
  146.     Clr.W    _ErrorCode
  147.  
  148.     Move.L    _Requestor(PC),A0
  149.     Lea    _ASLTags(PC),A1
  150.     CALL    AslRequest
  151.     Cmp.L    #FALSE,D0
  152.     Beq    .MsgLoop
  153.  
  154.     Move.L    _Requestor(PC),A0
  155.     Move.L    fr_ArgList(A0),_CurrentName
  156.     Move.L    fr_NumArgs(A0),D0
  157.     Move.W    D0,_LoopCount
  158.     Beq    .MsgLoop
  159.  
  160.     Clr.L    _FileName
  161.     Move.W    #ARGS_ASLREQ,_ArgMode
  162.  
  163.     Bsr    DoFiles
  164.  
  165.     Move.L    _Requestor(PC),A0    ;free up requestor structure
  166.     CALL    FreeAslRequest,ASL
  167.     Clr.L    _Requestor
  168.  
  169.     Move.L    _AppMsg(PC),A1
  170.     CALL    ReplyMsg,EXEC
  171.     Clr.L    _AppMsg
  172.  
  173.     Bra    .MsgLoop
  174.